﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tanmia.Warehouse.Core;
using FluentNHibernate.Mapping;

namespace Tanmia.Warehouse.NHibernateRepository.Mapping
{
    public class StoreMap : ClassMap<Store>
    {
        public StoreMap()
        {
            Table("Store");

            Id(x => x.StoreID).GeneratedBy.Identity().Unique();

            Map(x => x.Name).Not.Nullable().CustomType(typeof(string));
            Map(x => x.Abbreviation).CustomType(typeof(string));

            HasMany<Zone>(x => x.Subsection).KeyColumn("StoreID").Inverse();
            References(x => x.Branch, "BranchID").Nullable();

            Map(x => x.EngName);
            Map(x => x.Notes);
        }
    }
}
